from langchain.tools import Tool

import json

from .features_prompt import tool_prompt_rob_arm

def rob_arm(hand_info) -> bool:
    try:
        hand_info = json.loads(hand_info)
        speed = float(hand_info['speed'])
        hand_type = hand_info['hand_type']
        print(f"机器人手臂正在以{speed} cm/s的速度{hand_type}。")
        return True
    except:
        print("机器人分析指令失败，请重新输入")
        return False
    
    
robot_arm_tool = Tool(
        name = "rob_arm",
        func = rob_arm,
        description = tool_prompt_rob_arm,
        )